package com.platform.core.entity;

import com.platform.comm.enums.YnEnum;
import com.platform.enums.RoleType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * Description: 角色
 *
 * @author libin Created on 2019/7/15
 **/
@EqualsAndHashCode(callSuper = false, of = {"code", "delFlag"})
@Data
@Entity
@Table(name = "ncloud_sys_role")
public class SysRole implements Serializable {

    private static final long serialVersionUID = 3770348546630846950L;

    /**
     * 角色名
     */
    @Column(name = "role_name", length = 200)
    private String name;

    /**
     * 角色编码
     */
    @Column(name = "role_code", length = 50)
    private String code;

    /**
     * 角色类型
     */
    @Column(name = "role_type", length = 20)
    private RoleType roleType;

    /**
     * 状态标志
     */
    @Column(name = "delflag")
    private YnEnum delFlag;

    /**
     * 角色描述
     */
    @Column(name = "role_desc", length = 200)
    private String desc;

    /**
     * 管理域
     */
    @Column(name = "manage_domain", length = 36)
    private String domain;

    /**
     * 0：私有，1：共享
     */
    @Column(name = "shared", length = 2)
    private String shared;

    /**
     * 父角色
     */
    @Column(name = "role_parent", length = 36)
    private String parentId;

    /**
     * 角色路由
     */
    @Column(name = "route_code", length = 512)
    private String route;

    /**
     * 范围类型
     */
    @Column(name = "range_type", length = 20)
    private String rangeType;

    /**
     * 所属组织
     */
    @Column(name = "depart_id", length = 36)
    private String departId;

    /**
     * 同步状态
     */
    @Column(name = "sync_status", length = 3)
    private String syncStatus;

    /**
     * 所属应用
     */
    @Column(name = "app_id", length = 36)
    private String appId;

    @Getter
    @Setter
    @CreatedDate
    @Column(name = "create_date", nullable = false, updatable = false)
    private LocalDateTime createDate;


    /**
     * 修改时间
     */
    @Getter
    @Setter
    @LastModifiedDate
    @Column(name = "update_date")
    private LocalDateTime updateDate;

    @Id
    @Column(name = "id", length = 36)
    @Getter
    @Setter
    private String id;

    /**
     * 是否启用
     */
    @Column(name = "is_enable", length = 36)
    @Getter
    @Setter
    private String isEnable;

    /**
     * 数据权限范围
     * (0：全部数据权限,1 ：本部门数据权限,2：本部门及以下数据权限,3：仅本人数据权限)
     */
    @Column(name = "ds_type", length = 36)
    @Getter
    @Setter
    private String dsType;

    /**
     * 角色等级
     * 角色层级(0省,1市,2县,3乡,4村)
     */
    @Column(name = "role_lvl", length = 36)
    @Getter
    @Setter
    private String roleLvl;

    /**
     * 所属系统
     *
     */
    @Column(name = "system_code", length = 255)
    @Getter
    @Setter
    private String systemCode;


}
